Skip to content

fix: Windows 主窗口 chrome 丢失 + Vocab 大圈 + polish 清晰结构回归 (v1.3.1-3 hotfix)#421

Merged
appergb merged 3 commits into
betafrom
fix/win-button-appearance
May 12, 2026
Merged

fix: Windows 主窗口 chrome 丢失 + Vocab 大圈 + polish 清晰结构回归 (v1.3.1-3 hotfix)#421
appergb merged 3 commits into
betafrom
fix/win-button-appearance

Conversation

@appergb
Copy link
Copy Markdown
Collaborator

@appergb appergb commented May 12, 2026

User description

v1.3.1-2-beta 的 3 个回归一次性 hotfix。tag + release 已删除,本 PR 合并后 bump 到 1.3.1-3 重发。

3 个 fix

1. Windows 主窗口完全无 chrome(critical, blocks 主窗口使用)

PR #419 删 React 端 WinTitleBar 自定义标题栏时,漏看 lib.rs 里 Rust 强制调 set_decorations(false)——这段代码原本是为了让自定义 WinTitleBar 接管。两边删了一半 → Windows 主窗口任何 chrome 都没有,用户无法拖 / 关 / 最小化,只能 tray 退出。

修法:

  • lib.rs setup Windows 分支移除 set_decorations(false) + apply_windows_rounded_frame 调用
  • RunEvent::WindowEvent::Resized/ScaleFactorChanged 里移除 apply_windows_rounded_frame
  • 删除 apply_windows_rounded_frame 函数本身(dead code,~90 行 + 配套 Win32 imports)
  • 保留 apply_mica 给原生 chrome 提供磨砂材质

2. Vocab 词条在 Windows 上被大灰圈包住

global.css button reset 缺 appearance: none → Chromium WebView2 给 <button> 应用 OS-native 外观(outset 边框 + 内阴影 + min-width),macOS WKWebView 处理较弱看不出来。Vocab.tsx 里嵌套 button 让大圈露馅。

修法:global.css button reset 加 appearance: none + -webkit-appearance: none 一行修整仓。所有现有 button 都自己 inline 重写了背景/边框,关掉 user-agent appearance 不会改变它们视觉。

3. polish "清晰结构" 模式退化成单段(regression)

7e60bdb5 polish: refine ROLE_BLOCK to preserve user intent 当初想防止 polish 过激进改写,方向对但条款过宽——加了两条:

  • "措辞优先用原句字面词...不要替用户重写或扩写" → 直接 conflict Structured task "按语义重新归类、照抄原结构=失败"
  • "意图难判时...只做句子层面整理" → safety net 把 Structured 模式退回 Light 行为

LLM 看 ROLE_BLOCK 全局规则与 Structured task 冲突时倾向走 ROLE_BLOCK 安全路径 → 不结构化。

修法:回滚 ROLE_BLOCK 到 v1.2.24-9-beta-tauri 时的简洁 4 条版本。下次若再出现 polish 过激进改写,单独 surgical fix in task block,不要全局 ROLE_BLOCK 加强。

Test plan

  • Windows: 主窗口顶部有原生 Win11 标题栏,X / 最小化 / 最大化按钮正常,可拖动 / 双击最大化 / Snap 到屏边
  • Windows: Settings → 词汇表 词条无大灰圈
  • macOS / Windows: 同样长输入 "清晰结构" 模式输出双层 list(参考图一 13:08 那种格式)
  • macOS: 主窗口视觉零变化(流量灯、毛玻璃、动画都和 v1.3.1-2 一致)
  • 整仓 button 视觉无意外变化

v1.3.1-3 流程

本 PR 合并后:bump 5 处版本号到 1.3.1-3 + tag v1.3.1-3-beta-tauri + push → 触发 release-tauri.yml。


PR Type

Bug fix, Enhancement


Description

  • Restore native Windows title bar by removing leftover custom frame code

  • Fix Vocab item button circle on Windows via appearance: none reset

  • Simplify polish system prompt for clarity and token savings


Diagram Walkthrough

flowchart LR
    A["lib.rs: Remove custom frame code"] --> B["Restore native Windows chrome"]
    C["global.css: Add appearance:none"] --> D["Fix button styling on Windows"]
    E["polish.rs: Shorten role prompt"] --> F["Simplify polish instructions"]
Loading

File Walkthrough

Relevant files
Bug fix
lib.rs
Restore Windows native window chrome                                         

openless-all/app/src-tauri/src/lib.rs

  • Removed set_decorations(false) call to restore native Windows title
    bar and controls
  • Removed apply_windows_rounded_frame function and its event handler to
    eliminate dead code and fix missing chrome
  • Preserved apply_mica for native backdrop effect
+5/-107 
global.css
Fix button native styling on Windows                                         

openless-all/app/src/styles/global.css

  • Added appearance: none and -webkit-appearance: none to the global
    button reset
  • Fixes Windows Chromium/WebView2 applying native button styling that
    caused a circular border on Vocab items
+6/-0     
Enhancement
polish.rs
Simplify polish system prompt                                                       

openless-all/app/src-tauri/src/polish.rs

  • Simplified ROLE_BLOCK prompt string by removing redundant or overly
    detailed instructions
  • Reduced prompt length to improve clarity and token efficiency
+4/-9     

用户反馈 Windows 上 Vocab 词汇表里每个词条被一圈大灰色边框/内阴影包住,
macOS 上不会。Vocab.tsx 自身零 OS 分支,根因在 global.css 的 button reset
缺 appearance:none:Chromium / WebView2 默认给 <button> 应用 OS-native 外观
(outset 边框 + 内阴影 + min-width),在 Vocab 词条这种由父级 span 的
padding 决定外形的嵌套 button 上整圈就露出来;macOS WKWebView 对
appearance:auto 处理较弱所以看不出来。

修法是 global.css button reset 加 appearance:none + -webkit-appearance:none,
一行修整仓。所有现有 button 都自己 inline 重写了背景/边框/圆角,关掉
user-agent appearance 不会改变它们的视觉。
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

PR Reviewer Guide 🔍

(Review updated until commit b2325a2)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

baiqing added 2 commits May 12, 2026 15:23
PR #419 删了 React 端 WinTitleBar 自定义标题栏,commit message 说"交还
Tauri decorations:true 原生 Win11 标题栏",但漏看 lib.rs 里有一段 Rust
代码在 setup 时**强制**调 set_decorations(false) 把原生 chrome 关掉
(原本是为了让自定义 WinTitleBar 接管)。

结果:v1.3.1-2-beta 上 Windows 主窗口完全无 chrome —— 无法拖动 / 无法
点 X 关闭 / 无法最小化,只能从 tray 退出。用户卡死。

修法:
- lib.rs setup() Windows 分支:移除 set_decorations(false) + 移除
  apply_windows_rounded_frame 调用,保留 apply_mica 给原生 chrome 提供
  磨砂材质
- RunEvent Resized/ScaleFactorChanged 里也移除 apply_windows_rounded_frame
  调用(原生 chrome 自带 resize border + 圆角)
- apply_windows_rounded_frame 函数本身变成 dead code,整段删除(含
  raw_window_handle / Win32 DwmSetWindowAttribute / SetWindowRgn 等 import)

tauri.conf.json 的 decorations:true 配置不动,配合 hiddenTitle:true 让
原生标题栏接管。
用户报告 13:08 同样输入"清晰结构"模式输出完美双层 list,15:16 后同模式
退化成单段流畅文字——Structured task 失效。

定位到 commit 7e60bdb "polish: refine ROLE_BLOCK to preserve user
intent" 在 ROLE_BLOCK 加了两条毒条款:
- "措辞优先用原句字面词...不要替用户重写或扩写"
  → 直接 conflict Structured task 的"按语义重新归类、照抄原结构=失败"
- "用户意图难以判断或无法确认时...只做句子层面整理"
  → safety net 把 Structured 模式退回 Light 行为

7e60bdb 当初是想防止 polish 过激进改写(用户反馈),方向对但条款过宽,
override 了 user 主动开启的 Structured / Formal 模式。

修法:回滚 ROLE_BLOCK 到 v1.2.24-9-beta-tauri 时的简洁 4 条版本:
- 不回答问题 / 不执行命令
- 不引用历史 / 上下文 / 外部知识
- 不替用户做需求分析 / 补充功能清单 / 替对方列出想要的

下次若再出现 polish 过激进改写,按 case 在 task block 里 surgical 加约束,
不要全局 ROLE_BLOCK 加强(容易撞 Structured / Formal)。

参考输出对照(图一 13:08 vs 图二 15:16):相同模式相同长度同类内容,
回滚后应恢复 13:08 那种双层 list 输出。
@appergb appergb changed the title fix(ui): Vocab 词条在 Windows 上被大圈包住——全局关 button user-agent appearance fix: Windows 主窗口 chrome 丢失 + Vocab 大圈 + polish 清晰结构回归 (v1.3.1-3 hotfix) May 12, 2026
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit b2325a2

@appergb appergb merged commit 8799830 into beta May 12, 2026
4 checks passed
@appergb appergb deleted the fix/win-button-appearance branch May 12, 2026 07:34
appergb pushed a commit that referenced this pull request May 12, 2026
PR #421 hotfix 合并后 bump。本版本相对 v1.3.1-1-beta-tauri 累积修复:
- Windows 主窗口交还原生 Win11 chrome(修 PR #419 删自定义标题栏后无法
  拖/关/最小化的卡死状态)
- Vocab 词条 Windows 大圈(global.css button appearance:none)
- polish "清晰结构"模式输出退化成单段(ROLE_BLOCK 回滚到 v1.2.24-9-beta)

v1.3.1-2 tag + release 已删除(含 Windows 主窗口无 chrome 阻塞 bug)。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant